<br /><?php echo $html->link(__('Add New Theme'),'/admin/themes/add',array('class'=>'add_button'));?>
<!--<?php echo $html->link(__('Select Default Theme'),'/admin/themes/savetheme/default',array('class'=>'add_button'));?>-->
<br/><br/>
<?php $selectedTheme = Configure::read('cmsConfig.Theme.name');?>
<?php
// themeCount concept added to fix problem in deleting .svn related files. 
$themeCount = 0;
if(!empty($themes[0]))
{	
	foreach($themes[0] as $theme)
	{		
		if(file_exists(APP.'webroot'.DS.'themed'.DS.$theme.DS.$theme.'_preview.jpg')	)
		{
			$themeCount++;
		}
	}
}
if($themeCount > 0)
{
	?>
<div class='theme_list'>
		<?php 
		foreach($themes[0] as $theme)
		{		
			if(file_exists(APP.'webroot'.DS.'themed'.DS.$theme.DS.$theme.'_preview.jpg')	)
			{
				?>
				<div class="theme_section">
					<div>
						<h4><?php echo $html->link($theme,'/admin/themes/savetheme/'.$theme)?></h4>
						<?php echo $html->link($html->image('/themed/'.$theme.'/'.$theme."_preview.jpg",array('width'=>300,'height'=>200)),'/admin/themes/savetheme/'.$theme,array('escape'=>false))?>
					</div>
					<?php if($theme==$selectedTheme)
					{
						$confirmMessage = sprintf(__('This theme is presently selected. Would you really want to delete theme "%s"'),$theme);
					}
					else
					{
						$confirmMessage = sprintf(__('Are you sure to delete theme "%s"'),$theme);
					}
					?>
					
					<?php echo $html->link(__('Delete'),'/admin/themes/delete/'.$theme,array(),$confirmMessage);?>
				</div>
				<?php 
			 }
		}?> 
	</div>
<?php }else{?>
	<h4><?php echo __("There is no theme available")?></h4>
<?php }?><br />
